home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / programming / c / buttonclass / buttonclass.doc < prev    next >
Text File  |  1978-11-24  |  4KB  |  124 lines

  1.                        Boopsi Button Class 37.2
  2.  
  3.                                   by
  4.                             Douglas Keller
  5.  
  6.                           February, 24 1993
  7.  
  8. 0.  Introduction
  9. ----------------
  10.  
  11. Buttonclass is a boopsi custom gadget which looks like a standard
  12. gadtools button gadget.  The buttonclass supports a couple of things
  13. gadtools does not, the foreground and background color of the gadget
  14. can be changed, and the gadget can be put into the selected state so
  15. the gadget looks depressed.
  16.  
  17. ButtonClass is based on the example in the RKM Libraries manual.
  18.  
  19.  
  20. 1.  Files
  21. ---------
  22.  
  23. buttonclass.h - public include file for buttonclass 
  24.  
  25. buttonclass.c - Sas/C 6.2 code for the buttonclass
  26.  
  27. buttonclass.o - scanned library containing the buttonclass
  28.  
  29. lmkfile       - Sas/C 6.2 makefile
  30.  
  31. test          - test program that uses buttonclass
  32.  
  33. test.c        - source to test program
  34.  
  35. headers.h     - system headers for buttonclass.c
  36.  
  37. make_gst.c    - dummy .c file that includes headers.h, used so
  38.                 #defines in headers.h are NOT ignored by mgst.
  39.  
  40. 2.  Using the ButtonClass
  41. -------------------------
  42.  
  43. The buttonclass includes a set of functions to initialize and free the
  44. buttonclass.
  45.  
  46.     Class *initButtonGadgetClass ( struct Library *IntuitionBase,
  47.                struct Library *UtilityBase, struct Library *GfxBase );
  48.  
  49.     BOOL freeButtonGadgetClass ( Class *cl );
  50.  
  51. InitButtonGadgetClass() takes IntuitionBase, UtilityBase, and GfxBase
  52. as arguments.  The reason they are passed in rather then global is so
  53. the buttonclass can be used in a reentrant program which has no
  54. writable global data.
  55.  
  56. The Class returned by initButtonGadgetClass() is then passed to
  57. NewObject() to create the gadget.
  58.  
  59.     gad = NewObject(buttonClass, NULL,
  60.         GA_ID,          1L,
  61.         GA_Top,         20
  62.         GA_Left,        20,
  63.         GA_Width,       100,
  64.         GA_Height,      11,
  65.         GA_Immediate,   TRUE,
  66.         GA_RelVerify,   TRUE,
  67.         BUT_Text,       "Label",
  68.         TAG_DONE);
  69.  
  70. SetGadgetAttrs() can be used to change gadget attributes.
  71.  
  72.     SetGadgetAttrs(gad, window, NULL,  /* make the gadget selected */
  73.         GA_Selected,    TRUE,
  74.         TAG_DONE);
  75.  
  76.     SetGadgetAttrs(gad, window, NULL,  /* change gadget text */
  77.         BUT_Text,       "new text",
  78.         TAG_DONE);
  79.  
  80. Buttonclass supports the following gadgets.
  81.  
  82.     BUT_Text       - STRPTR used for the text of the gadget.
  83.     BUT_Color      - Foreground (text) color of the gadget.
  84.     BUT_Key        - char which should be underlined if found in BUT_Text.
  85.     BUT_BackColor  - Background color of the gadget.
  86.     BUT_TextFont   - TextFont struct to used for BUT_Text.
  87.  
  88.     New of 37.2
  89.  
  90.     BUT_Image      - Image to display in the unselected state, (struct Image *)
  91.     BUT_SelectImage- Image to display in the selected state, (struct Image *)
  92.     GA_Disabled    - Disabled TRUE or FALSE.
  93.  
  94. Currently the Images are drawn relative to the top left corner of
  95. the gadget using the TopEdge and LeftEdge of Image.  When I get some
  96. time I am going to add support for different justifications of the
  97. Images and Text.
  98.  
  99. If only a BUT_Image is given, the image is draw in the selected state
  100. when it is selected.  This allows boopsi images to be drawn in the
  101. selected state.
  102.  
  103.  
  104. 3.  Legal junk
  105. --------------
  106.  
  107. Permission is granted to distribute this program and its documentation
  108. for non-commercial purposes.  This program may not be distributed for
  109. a profit without permission from Doug Keller.  Fred Fish has
  110. permission to distribute this program as part of the Fred Fish
  111. library.
  112.  
  113. This code can be used for any purpose as long as credit is given.
  114.  
  115.  
  116. 4.  Bugs and Info
  117. -----------------
  118.  
  119. If you would like to get in touch with me I can be reached on the
  120. following:
  121.  
  122.             Bix : dkeller
  123.         Internet: dkeller@vnet.ibm.com
  124.